<template>
  <div>
    <div class="common-form">活动时间</div>

    <el-form-item
      label="活动时间"
      :rules="[{ required: true, message: ' ' }]"
      prop="activeRange"
    >
      <el-date-picker v-model="form.activeRange" type="datetimerange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" value-format="YYYY-MM-DD HH:mm:ss" :disabled="disabled"/>
    
      <!-- <el-date-picker
        v-model="form.startDate"
        type="datetime"
        placeholder="选择开始日期"
        :disabled="disabled"
      >
      </el-date-picker>
      <span>-</span>
      <el-date-picker
        v-model="form.endDate"
        type="datetime"
        placeholder="选择结束日期"
        :disabled="disabled"
      >
      </el-date-picker> -->
    </el-form-item>
    <el-form-item  v-if="form.activityType !== 2"
      label="每天活动时间"
      prop="activeTime"
      :rules="[
        { required: true, message: '请选择每天活动时间', trigger: 'change' },
      ]"
    >
      <el-time-picker is-range v-model="form.activeTime" range-separator="至" start-placeholder="开始时间" end-placeholder="结束时间" placeholder="选择时间范围" format="HH:mm" value-format="HH:mm" :disabled="disabled"></el-time-picker>
    </el-form-item>
  </div>
</template>

<script>
export default {
  data() {
    return {
      /*时间*/
      timeVal: new Date(2016, 9, 10, 8, 0, 0),
      /*如果没有后面的-8.64e7就是不可以选择今天的*/
      pickerOptions: {
        disabledDate(time) {
          return time.getTime() < Date.now() - 8.64e7;
        },
      },
      disabled:false,
          
    };
  },
  props: {
    form: Object,
  },
  created() {
    this.disabled =  this.$route.query.type === 'view'
  },
};
</script>

<style></style>
